<template>
  <div v-if="Object.keys(detailGoods).length!==0" class="base-info">
    <div class="info-price">
      <h3>{{detailGoods.title}}</h3>
      <div class="price">
        <span>￥{{detailGoods.realPrice}}</span>
        <span>{{detailGoods.oldPrice}}</span>
        <span v-if="detailGoods.discount">{{detailGoods.discount}}</span>
      </div>
    </div>
    <div class="info-other">
      <span>{{detailGoods.columns[0]}}</span>
      <span>{{detailGoods.columns[1]}}</span>
      <span>{{detailGoods.services[1].name}}</span>
    </div>
    <div class="base" >
      <span v-for="(item,index) in (detailGoods.services)" :key="index">
        <img :src="item.icon" alt="" class="icon">
        {{item.name}}</span>
    </div>
  </div>
</template>

<script>
  export default {
    name: "DetailBaseInfo",
    props: {
      detailGoods: {
        type: Object,
        default(){
          return {}
        }
      },
    },
  }
</script>

<style scoped>
  .base-info{
    margin-top: 10px;
  }
  .info-price{
    height: 110px;
  }
.base-info>div:nth-child(1){
  padding: 5px;
}
.price>span:nth-child(1){
  font-size: 28px;
  color: deeppink;
}
.price>span:nth-child(2){
  margin-left: 5px;
  text-decoration-line:  line-through;
}
.price{
  position: absolute;
  margin-left: -10px;
  margin-top: 10px;
}
.price>span:nth-child(3){
 position: relative;
  top: -15px;
  background: deeppink;
  display: inline-block;
  height: 25px;
  color: #fff;
  border-radius:20px;
  line-height: 25px;
  font-size: 10px;
}
  .info-other{
    display: flex;
    margin:0px 5px;
    border-bottom: 2px solid #eee;
  }
  .info-other>span{
    flex: 1;
    text-align: center;
    margin-bottom: 5px;
  }
  .base{
    padding:0px 10px;
    height: 60px;
    color: #8D8D8D;
    text-align: center;
    line-height: 60px;
    margin:0px 5px;
    border-bottom: 2px solid #eee;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .base>span{
    flex:1;
  }
  .base .icon{
    width: 20px;
    vertical-align: text-bottom;
  }
</style>